*********************************************************************************
/* Single-diff event study, by 4-year groups	*/
*********************************************************************************
* Set directories 

adopath + "${oi_home}/Research files/ado"

* File paths
local datapath "${mvpf_audits}/data/cleaned" 
local datafolder "${mvpf_audits}/data/outside" 
local graphpath "${graphpath}" 

* Version of fig to produce 
global version  ${version} // paper or slides

* Other formatting
if "${version}" == "slides" {
	global title "title(" ", size(vhuge))"
	global img wmf
	graph set window fontface "Arial"
	global title "title(" ", size(vhuge))"
	global axis_size "" //xsize(6.5) ysize(4)" // makes figure wider
}

else if "${version}" == "paper" {
	global title "title("")"
	global img pdf
	graph set window fontface "LMRoman10-Regular"
	global title " "
	global axis_size " " // makes figure wider
}

/*------------------------------------------------------------------------------
Plot event studies by year
------------------------------------------------------------------------------*/

	use "${mvpf_audits}/data/figures_rep/ap13_a.dta", clear
	
	* cap y-axis
	foreach var in coeff{
	    replace `var'_h = 800 if `var'_h>=800
		replace `var'_l = -400 if `var'_l<=-400
	}

	twoway  (rspike coeff_h coeff_l event if year==69, lc(gs4) lw(thin)) ///
			(rspike coeff_h coeff_l event2 if year==1014, lc(sky) lw(thin)) ///
			(scatter coeff event2 if year==1014, mc(sky) msize(small) ms(O)) ///
			(line coeff event2 if year==1014, lc(sky)) ///
			(scatter coeff event if year==69, mc(gs4) msize(small) ms(O)) ///
			(line coeff event if year==69, lc(gs4)) ///
			, ///
			xline(0.5, lw(vthin) lc(gs11)) ///
			yline(0, lw(vthin) lc(gs11)) ///
			xtitle("Year relative to tax year of audited return") ///
			ytitle("Taxes Paid") ///
			xlabel(-14(2)14 , nogrid)  ///
			ylab(-500(500)1500, nogrid format(%5.0fc))  ///
			legend(ring(0) pos(11) row(2) symxsize(*0.3) order(5 3) ///
			lab(5 "2006-2009") lab(3 "2010-2014")) ///
			${title} ${axis_size}	
